import { httpGet, httpPost, httpDelete, httpPut } from '@/http'
import { services } from '@/config'

export const getPage = params => httpPost(`${services.personnelService}bookApply/page`, params)

export const save = data => httpPost(`${services.personnelService}bookApply`, data)

export const load = id => httpGet(`${services.personnelService}bookApply/${id}`)
export const create = () => httpGet(`${services.personnelService}bookApply/create`)

export const delObj = id => httpDelete(`${services.personnelService}bookApply/${id}`)

export const update = data => httpPut(`${services.personnelService}bookApply`, data)

export const batchDelete = ids => httpDelete(`${services.personnelService}bookApply/batchDelete`, ids, null, false)
export const returnBook = ids => httpPost(`${services.personnelService}bookApply/returnBook`, ids)
export const checkBooksStatus = ids => httpPost(`${services.personnelService}bookApply/checkBooksStatus`, ids)

export const borrowHistory = (data, bookId) =>
  httpPost(`${services.personnelService}bookApply/borrowHistory`, data, false, { bookId })

export const borrowHistory2 = data => httpPost(`${services.personnelService}applyBook/page`, data)
